class Friendship < ActiveRecord::Base

  belongs_to :friend,
    :foreign_key => "friend_id",
    :class_name => "Friend"
  belongs_to :dneirf,
    :foreign_key => "dneirf_id",
    :class_name => "Friend"

  #TODO make a plugin baby!
  #domainalize :hint

  serialize :hint, Array

  #hints manager
  def has_hints?(*hints)
    hintme(hint)
    hints.collect{|hint| self.hint.member? hint.to_sym }
  end

  def has_hint?(hint)
    hintme(hint)
    self.hint.member? hint.to_sym
  end

  def add_hint(hint)
    hintme(hint)
    self.hint << hint unless self.hint.member? hint.to_sym
  end

  def remove_hint(hint)
    hintme(hint)
    self.hint.delete hint.to_sym
  end

  def hintme(hint)
    self.hint ||= []
    hint.downcase! if hint.is_a? String
  end

end